package cn.edu.nyist.integration.controller;

import cn.edu.nyist.integration.common.ServerResponse;
import cn.edu.nyist.integration.entity.Category;
import cn.edu.nyist.integration.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;


    @PostMapping("/addCategory")
    @ResponseBody
    public ServerResponse addCategory(String categoryName){
        Category category = new Category();
        category.setCategoryName(categoryName);
        return categoryService.addCategory(category);

    }



}
